package settingsapp.settings.toggle;

import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import ece.settingsapp.R;

public class SettingGps extends ToggleSettingChanger
{
	public SettingGps(Context context, int intRepresentation)
	{
		super(context, intRepresentation);
		this.context = context;
	}
	
	protected void setValue(boolean value)
	{
		// can't set gps on non-rooted phones
		// send user to android preferences screen
		Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
		context.startActivity(intent);
	}

	@Override
	public void readValue()
	{
		isOn = (android.provider.Settings.System.getInt(context.getContentResolver(),
			android.provider.Settings.System.ACCELEROMETER_ROTATION, isOn ? 1 : 0) != 0);
	}

	@Override
	public int getResourceOn()
	{
		return R.drawable.gps_on;
	}

	@Override
	public int getResourceOff()
	{
		return R.drawable.gps_off;
	}
}
